[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Variables                Define Variables                     Program Section

    Pascal allows you to declare variables within your program (and within
    subprograms as well). A variable is a portion of computer memory that
    is given a name; you can then store and retrieve information within
    your program by referring to the name.

    Variables are declared in the declaration section of the program or
    subprogram. A list of variable declarations is preceded by the word
    VAR and uses the following syntax:

         var
           <vnames>   : <basetype>;
           <vnames>   : <tdecl>;
           { etc. }

    where <vnames> is a list of one or more legal identifier, <basetype>
    is any previously declared data type, and <tdecl> is a legal type
    declaration. In other words, you can use existing data types, or
    declare new ones on the fly. However, if you do declare new data
    types, they are unnamed, and so cannot be used to declare other
    variables or parameters. See "types" for more information on legal
    type declarations.

    In Standard Pascal, you can have only one VAR section in a program (or
    subprogram), and it must come after the TYPE section and before any
    procedures or function. In Turbo Pascal, you can have as many VAR
    sections as you want, and there are no ordering restrictions.

  -------------------------------- Example ---------------------------------

    See "var" for examples

See Also: var constants types typed constants
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson